{% extends 'homepage.html' %}
{% block content %}
{# Displays individual number field homepage #}
<script>
var cur_system = null;
function show_code(system) {
    $('.sage').hide();
    $('.pari').hide();
    $('.magma').hide();
    if (cur_system == system) {
      $('.'+system).hide();
      cur_system = null;
    } else {
      $('.'+system).show();
      cur_system = system;
    }
}
</script>

    <div align ="right">
      Show commands for:  <a onclick="show_code('sage'); return false" href='#'>sage</a>,
        <a onclick="show_code('pari'); return false" href='#'>pari</a>,
        <a onclick="show_code('magma'); return false" href='#'>magma</a>
    </div>
    <div></div>

{% set nf = info.wnf %}
<p>
  <div class='sage nodisplay code'>sage: K = NumberField({{ nf.poly() }},'a')</div>
  <div class='pari nodisplay code'>pari: K = bnfinit({{ nf.poly() }}, 1)</div>
  <div class='magma nodisplay code'>&gt; K&lt;a&gt; := NumberField(PolynomialRing(Rationals())!{{info.coefficients}});</div>
</p>
        {% set KNOWL_ID = "nf.%s"|format(info['label_raw']) %}
        <h2>{{ KNOWL_INC(KNOWL_ID+'.top', title='') }}</h2>

        <p><h2> {{ KNOWL('nf.defining_polynomial.normalization', title='Normalized') }}
        {{ KNOWL('nf.defining_polynomial', title='defining polynomial') }}</h2>
        <div class='sage nodisplay code'>sage: K.defining_polynomial()</div>
        <div class='pari nodisplay code'>pari: K.pol</div>
        <div class='magma nodisplay code'>&gt; DefiningPolynomial(K);</div>
        <p>
            {{ info.polynomial }}
        </p>

        <p><h2> {{ KNOWL('nf.invariants', title='Invariants') }}</h2>
        <div class='sage nodisplay code'>sage: K.degree()</div>
        <div class='sage nodisplay code'>sage: K.signature()</div>
        <div class='sage nodisplay code'>sage: K.disc()</div>
        <div class='sage nodisplay code'>sage: K.disc().support()</div>
        <div class='pari nodisplay code'>pari: poldegree(K.pol)</div>
        <div class='pari nodisplay code'>pari: K.sign</div>
        <div class='pari nodisplay code'>pari: K.disc</div>
        <div class='pari nodisplay code'>pari: factor(abs(K.disc))[,1]~</div>
        <div class='magma nodisplay code'>&gt; Degree(K);</div>
        <div class='magma nodisplay code'>&gt; Signature(K);</div>
        <div class='magma nodisplay code'>&gt; Discriminant(K);</div>
        <div class='magma nodisplay code'>&gt; PrimeDivisors(Discriminant(K));</div>
        <p>
          <table>
            <tr><td>Degree:<td>&nbsp;&nbsp;<td>${{info.degree}}$</tr>
            <tr><td>Signature:<td>&nbsp;&nbsp;<td>${{info.signature}}$</tr>
            <tr><td>Discriminant:<td>&nbsp;&nbsp;<td>{{info.discriminant}}</tr>
            <tr><td>Ramified primes:<td>&nbsp;&nbsp;<td>${{info.ram_primes}}$</tr>
  {% if info.is_abelian %}
			<tr><td colspan="3">&nbsp;</tr>
            <tr><td colspan="3">Extension is Galois and abelian</tr>
            <tr><td>Conductor:<td>&nbsp;&nbsp;<td>{{info.conductor}}</tr>
            <tr><td>Dirichlet
				group:<td>&nbsp;&nbsp;<td>{{info.dirichlet_group|safe}}</tr> 
  {% elif info.is_galois %}
            <tr><td colspan="3">Extension is Galois</tr>
  {% endif %}

          </table>
        </p>

{% if info.degree==1 %}
        <p><h2> {{ KNOWL('nf.integral_basis', title='Integral basis') }} </h2>
{% endif %}
{% if info.degree!=1 %}
        <p><h2> {{ KNOWL('nf.integral_basis', title='Integral basis') }} (with respect to {{ KNOWL('nf.field_generator', title='field generator') }} \(a\))</h2>
{% endif %}
        <div class='sage nodisplay code'>sage: K.integral_basis()</div>
        <div class='pari nodisplay code'>pari: K.zk</div>
        <div class='magma nodisplay code'>&gt; IntegralBasis(K);</div>
        <p>
            {{ info.integral_basis }}
        </p>

        <p><h2> {{ KNOWL('nf.ideal_class_group', title='Class group') }} and  {{ KNOWL('nf.class_number', title='class number') }}</h2>
        <div class='sage nodisplay code'>sage: K.class_group().invariants()</div>
        <div class='pari nodisplay code'>pari: K.clgp</div>
        <div class='magma nodisplay code'>&gt; ClassGroup(K);</div>
	<p>
          {{ info.class_group }}
          {{ info.grh_label|safe }}
        </p>


        <p><h2> {{ KNOWL('nf.unit_group', title='Unit group') }}</h2>
        <div class='sage nodisplay code'>sage: UK = K.unit_group()</div>
        <div class='sage nodisplay code'>sage: UK.rank()</div>
        <div class='sage nodisplay code'>sage: UK.torsion_generator()</div>
        <div class='sage nodisplay code'>sage: UK.roots_of_unity()</div>
        <div class='sage nodisplay code'>sage: K.regulator()</div>

        <div class='pari nodisplay code'>pari: #K.fu</div>
        <div class='pari nodisplay code'>pari: K.tu[2]</div>
        <div class='pari nodisplay code'>pari: K.fu</div>
        <div class='pari nodisplay code'>pari: K.reg</div>

        <div class='magma nodisplay code'>&gt; UnitRank(K);</div>
        <div class='magma nodisplay code'>&gt; K!f(TorsionSubgroup(UK).1);</div>
        <div class='magma nodisplay code'>&gt; [K!Integers(K)!f(u) : u in Generators(UK)];</div>
        <div class='magma nodisplay code'>&gt; Regulator(K);</div>
        <p>
          <table>
            <tr><td>Rank:<td>&nbsp;&nbsp;<td>${{info.unit_rank}}$</tr>
            <tr><td>Torsion generator:<td>&nbsp;&nbsp;<td>{{info.root_of_unity}}</tr>
{% if info.unit_rank==1 %}
            <tr><td>Fundamental unit:<td>&nbsp;&nbsp;<td>{{info.fund_units|safe}}
          {{ info.grh_label|safe }}
</tr>
{% endif %}
{% if info.unit_rank>1 %}
            <tr><td>Fundamental units:<td>&nbsp;&nbsp;<td>{{info.fund_units|safe}}
          {{ info.grh_label|safe }}
</tr>
{% endif %}
            <tr><td>Regulator:<td>&nbsp;&nbsp;<td>{{info.regulator}}
          {{ info.grh_label|safe }}
           </tr>
          </table>
        </p>


        <p><h2> {{ KNOWL('nf.galois_group', title='Galois group') }}</h2>
        <div class='sage nodisplay code'>sage: K.galois_group(type='pari')</div>
        <div class='pari nodisplay code'>pari: polgalois(pol)</div>
        <div class='magma nodisplay code'>&gt; GaloisGroup(K);</div>
        <p>
            {{ info.galois_group | safe }}:
          <table>
            <tr><td>{{ info.phrase }}</tr>
            <tr><td>
            {{ info.cclasses | safe }}</tr>
            <tr><td>
            {{ info.character_table | safe }}</tr>
          </table>

        <p><h2> {{ KNOWL('nf.frobenius_cycle_types', title='Frobenius cycle types') }}</h2>
        <p><center>
           <table class="ntdata" >
	    <thead>
             <tr><th>$p$</th>
            {% for p in info.frob_data %}
            <td>{{ p[0] | safe }} </td>
            {% endfor %}
             </tr>
	    </thead>
	    <tbody>
             <tr><th>Cycle type</th>
            {% for p in info.frob_data %}
            <td>{{ p[1] | safe }} </td>
            {% endfor %}
             </tr>
	     </tbody>
           </table>
	   </center>
        </p>
<p>
   {% if info.seeram %}
   In the table, <i>R</i> denotes a ramified prime.  
   {% endif %}
   Cycle lengths 
   which are repeated in a cycle type are indicated by exponents.
        <p>
  <div class='pari nodisplay code'>
   To obtain a list of [\(e_i, f_i\)] for the factorization of the ideal
 \(p\mathcal{O}_K\) <br>
pari: 
<br>
  p = 7;  \\ set a prime
<br>
  idealfactors = idealprimedec(K, p); \\ get the data
<br>
  vector(length(idealfactors), j, [idealfactors[j][3], idealfactors[j][4]])
</div>
  <div class='sage nodisplay code'>
   sage:
<br>
  p = 7   # set a prime
<br>
  idealfactors = K.factor(p)  # get the data
<br>
  [[e, primefactor.residue_class_degree()] for primefactor,e in idealfactors]
  </div>
  <div class='magma nodisplay code'>
<br>
  p := 7;   # set a prime
<br>
  idealfactors := Factorization(p*Integers(K));  # get the data
<br>
  [<Valuation(Norm(primefactor[1]), p), primefactor[2]> : primefactor in idealfactors];
</div>

{% if info.get("tim_number_field", False) %}
	<p><h2> {{ KNOWL('artin', title='Artin representations') }}</h2>
        <div>
	<center>
	<table>

	<thead><tr><th></th>
	<th>{{ KNOWL('artin.dimension', title='Dimension') }}</th>
	<th>{{ KNOWL('artin.conductor', title='Conductor') }}</th>
	<th>Defining polynomial of {{ KNOWL('artin.number_field', title='Artin field') }} </th>
	<th>{{ KNOWL('artin.gg_quotient', title='Galois image $G$') }}</th>
	<th>Size of $G$</th>
	<th>{{ KNOWL('artin.root_number', title='Root number') }}</th>
	<th>{{ KNOWL('artin.frobenius_schur_indicator', title='Frobenius-Schur indicator') }}</th>
	<th>Trace of complex conjugation</th>
	</tr></thead>
	<tbody>
        {% for artin in info["tim_number_field"].artin_representations()%}
          <tr> <th><a href = "{{artin.url_for()}}">{{loop.index}}</a></th><th>${{artin.dimension()}}$</th>
	  <th>${{artin.conductor_equation()}}$</th>
	  {% if artin.number_field_galois_group().url_for() %}
	     <th><a href="{{artin.number_field_galois_group().url_for()}}">${{artin.number_field_galois_group().polredabslatex()}}$</a></th>
	  {% else %}
	      <th>${{artin.number_field_galois_group().polredabslatex()}}$</th>
	  {% endif %}
	  <th>{{artin.number_field_galois_group().G_name()}}</th>
	  <th>${{artin.number_field_galois_group().size()}}$</th>
	  <th>${{artin.processed_root_number()}}$</th>
	  <th> ${{artin.indicator()}}$</th>
	  <th>${{artin.trace_complex_conjugation()}}$</th>
	  </tr>
        {% endfor %}
	</tbody>
	</table>
	</center>
	</div>
	{% endif %}

        <h2>{{ KNOWL_INC(KNOWL_ID+'.bottom', title='') }}</h2>

{% endblock %}
